package gui;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseMotionAdapter;
import javax.swing.BorderFactory;
import javax.swing.BoxLayout;

import javax.swing.DefaultComboBoxModel;
import javax.swing.GroupLayout;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JComponent;
import javax.swing.JFileChooser;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JPanel;
import javax.swing.JSpinner;
import javax.swing.JTextField;
import javax.swing.LayoutStyle;
import javax.swing.SpinnerNumberModel;
import javax.swing.SwingConstants;
import javax.swing.WindowConstants;
import javax.swing.border.LineBorder;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;

//VS4E -- DO NOT REMOVE THIS LINE!

/**
* This code was edited or generated using CloudGarden's Jigloo
* SWT/Swing GUI Builder, which is free for non-commercial
* use. If Jigloo is being used commercially (ie, by a corporation,
* company or business for any purpose whatever) then you
* should purchase a license for each developer using Jigloo.
* Please visit www.cloudgarden.com for details.
* Use of Jigloo implies acceptance of these licensing terms.
* A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
* THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
* LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
*/
public class MainFrame extends JFrame {

	{
		//Set Look & Feel
		try {
			javax.swing.UIManager.setLookAndFeel("com.jgoodies.looks.plastic.Plastic3DLookAndFeel");
		} catch(Exception e) {
			e.printStackTrace();
		}
	}




	private static final long serialVersionUID = 1L;
	private JLabel jLabelPlace;
	private JTextField jTextFieldPlace;
	private JLabel jLabelAxis;
	private JTextField jTextFieldAxisLatitude;
	private JTextField jTextFieldAxisLongitude;
	private JButton jButtonAxis;
	private JPanel jPanelImage;
	private JLabel statusJLabel;
	private JPanel statusJPanel;
	private JMenuItem jMenuItem6;
	private JMenuItem jMenuItem5;
	private JMenuItem jMenuItem4;
	private JMenuItem jMenuItem3;
	private JMenuItem jMenuItem2;
	private JMenuItem jMenuItem1;
	private JPanel jPanel1;
	private JPanel mapaJPanel;
	private JPanel jPanel4;
	private JPanel jPanel3;
	private JPanel jPanel2;
	private JPanel nastaveniJPanel;
	private JMenuItem smazatFotoDBMenuItem;
	private JMenuItem generovatFotoDBMenuItem;
	private JMenu napovedaMenu;
	private JMenu trasyMenu;
	private JMenu fotoMenu;
	private MapGenerator mapGenerator;
	private JLabel jLabelZoom;
	private JSpinner jSpinnerZoom;
	private int lastMouseX=0;
	private int lastMouseY=0;
	private int actualMouseX=0;
	private int actualMouseY=0;
	private JLabel jLabelView;
	private JComboBox jComboBoxView;
	private JMenuItem jMenuItem0;
	private JMenu jMenu0;
	private JMenuBar jMenuBar0;
	private JButton jButton0;
	public MainFrame() {
		mapGenerator = new MapGenerator();
		initComponents();
		getJSpinnerZoom().setValue(mapGenerator.getZoom());
		getJTextFieldAxisLatitude().setText(String.valueOf(mapGenerator.getLatitude()));
		getJTextFieldAxisLongitude().setText(String.valueOf(mapGenerator.getLongitude()));
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
	}

	private void initComponents() {
		setTitle("Fotoloc");
		setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
		setFont(new Font("Dialog", Font.PLAIN, 12));
		setForeground(Color.black);
		getContentPane().add(getNastaveniJPanel(), BorderLayout.NORTH);
		getContentPane().add(getMapaJPanel(), BorderLayout.CENTER);
		getContentPane().add(getStatusJPanel(), BorderLayout.SOUTH);
		getMapaJPanel().add(getJPanelImage(), BorderLayout.CENTER);
		setJMenuBar(getJMenuBar0());
		setSize(948, 755);
	}



	private JButton getJButton0() {
		if (jButton0 == null) {
			jButton0 = new JButton();
			jButton0.setText("Hledat");
			jButton0.setBorder(new LineBorder(Color.black, 1, false));
		}
		return jButton0;
	}

	private JMenuBar getJMenuBar0() {
		if (jMenuBar0 == null) {
			jMenuBar0 = new JMenuBar();
			jMenuBar0.add(getJMenu0());
			jMenuBar0.add(getFotoMenu());
			jMenuBar0.add(getTrasyMenu());
			jMenuBar0.add(getNapovedaMenu());
		}
		return jMenuBar0;
	}

	private JMenu getJMenu0() {
		if (jMenu0 == null) {
			jMenu0 = new JMenu();
			jMenu0.setText("Program");
			jMenu0.add(getJMenuItem4());
			jMenu0.add(getJMenuItem3());
			jMenu0.add(getJMenuItem0());
		}
		return jMenu0;
	}

	private JMenuItem getJMenuItem0() {
		if (jMenuItem0 == null) {
			jMenuItem0 = new JMenuItem();
			jMenuItem0.setText("Ukončit");
		}
		return jMenuItem0;
	}

	private JComboBox getJComboBoxView() {
		if (jComboBoxView == null) {
			jComboBoxView = new JComboBox();
			jComboBoxView.setModel(new DefaultComboBoxModel(new Object[] { "silničí", "satelitní", "teréní", "hybridní" }));
			jComboBoxView.setMinimumSize(new Dimension(80, 24));
			jComboBoxView.setMaximumSize(new Dimension(80, 32767));
			jComboBoxView.setDoubleBuffered(false);
			jComboBoxView.setBorder(null);
			jComboBoxView.setBounds(218, 21, 117, 27);
			jComboBoxView.addItemListener(new ItemListener() {
	
				public void itemStateChanged(ItemEvent event) {
					jComboBox0ItemItemStateChanged(event);
				}
			});
		}
		return jComboBoxView;
	}

	private JLabel getJLabelView() {
		if (jLabelView == null) {
			jLabelView = new JLabel();
			jLabelView.setHorizontalAlignment(SwingConstants.CENTER);
			jLabelView.setText("Typy zobrazení:");
			jLabelView.setMinimumSize(new Dimension(110, 15));
			jLabelView.setMaximumSize(new Dimension(110, 15));
			jLabelView.setOpaque(true);
			jLabelView.setBounds(208, 3, 132, 15);
		}
		return jLabelView;
	}

	private JLabel getJLabelZoom() {
		if (jLabelZoom == null) {
			jLabelZoom = new JLabel();
			jLabelZoom.setHorizontalAlignment(SwingConstants.CENTER);
			jLabelZoom.setText("Zoom:");
			jLabelZoom.setMinimumSize(new Dimension(50, 15));
			jLabelZoom.setMaximumSize(new Dimension(50, 15));
			jLabelZoom.setBounds(352, 3, 40, 15);
		}
		return jLabelZoom;
	}

	private JSpinner getJSpinnerZoom() {
		if (jSpinnerZoom == null) {
			jSpinnerZoom = new JSpinner();
			jSpinnerZoom.setModel(new SpinnerNumberModel());
			jSpinnerZoom.setMinimumSize(new Dimension(50, 20));
			jSpinnerZoom.setMaximumSize(new Dimension(38, 32767));
			jSpinnerZoom.setBounds(353, 21, 56, 27);
			jSpinnerZoom.addChangeListener(new ChangeListener() {
	
				public void stateChanged(ChangeEvent event) {
					jSpinnerZoomChangeStateChanged(event);
				}
			});
		}
		return jSpinnerZoom;
	}

	private JPanel getJPanelImage() {
		if (jPanelImage == null) {
			jPanelImage = new JPanelPicture();
			jPanelImage.setFocusable(true);
			jPanelImage.setEnabled(true);
			jPanelImage.setVisible(true);
			//jPanelImage.setMinimumSize(new Dimension(642, 642));
			//jPanelImage.setPreferredSize(new Dimension(642, 642));
			//jPanelImage.setMaximumSize(new Dimension(642, 642));
			jPanelImage.setDoubleBuffered(true);
			jPanelImage.setVerifyInputWhenFocusTarget(true);
			jPanelImage.setRequestFocusEnabled(true);
			jPanelImage.setFocusCycleRoot(true);
			jPanelImage.setOpaque(true);
			//jPanelImage.setLayout(new BorderLayout());
			jPanelImage.addMouseListener(new MouseAdapter() {
	
				public void mousePressed(MouseEvent event) {
					jPanelImageMouseMousePressed(event);
				}
	
				public void mouseReleased(MouseEvent event) {
					jPanelImageMouseMouseReleased(event);
				}
			});
			jPanelImage.addMouseMotionListener(new MouseMotionAdapter() {
	
				public void mouseDragged(MouseEvent event) {
					jPanelImageMouseMotionMouseDragged(event);
				}
			});
		}
		return jPanelImage;
	}

	private JButton getJButtonAxis() {
		if (jButtonAxis == null) {
			jButtonAxis = new JButton();
			jButtonAxis.setText("Nastav");
			jButtonAxis.setMinimumSize(new Dimension(49, 15));
			jButtonAxis.setMaximumSize(new Dimension(49, 15));
			jButtonAxis.setBorder(new LineBorder(Color.black, 1, false));
			jButtonAxis.setDefaultCapable(false);
		}
		return jButtonAxis;
	}

	private JTextField getJTextFieldAxisLongitude() {
		if (jTextFieldAxisLongitude == null) {
			jTextFieldAxisLongitude = new JTextField();
			jTextFieldAxisLongitude.setBounds(625, 40, 186, 24);
		}
		return jTextFieldAxisLongitude;
	}

	private JTextField getJTextFieldAxisLatitude() {
		if (jTextFieldAxisLatitude == null) {
			jTextFieldAxisLatitude = new JTextField();
			jTextFieldAxisLatitude.setBounds(425, 21, 174, 24);
		}
		return jTextFieldAxisLatitude;
	}

	private JLabel getJLabelAxis() {
		if (jLabelAxis == null) {
			jLabelAxis = new JLabel();
			jLabelAxis.setText("Souřadnice:");
			jLabelAxis.setMinimumSize(new Dimension(77, 15));
			jLabelAxis.setMaximumSize(new Dimension(77, 15));
			jLabelAxis.setBounds(425, 3, 89, 15);
		}
		return jLabelAxis;
	}

	private JTextField getJTextFieldPlace() {
		if (jTextFieldPlace == null) {
			jTextFieldPlace = new JTextField();
		}
		return jTextFieldPlace;
	}

	private JLabel getJLabelPlace() {
		if (jLabelPlace == null) {
			jLabelPlace = new JLabel();
			jLabelPlace.setText("Místo:");
			jLabelPlace.setMinimumSize(new Dimension(45, 15));
			jLabelPlace.setMaximumSize(new Dimension(45, 15));
		}
		return jLabelPlace;
	}

	private void jSpinnerZoomChangeStateChanged(ChangeEvent event) {
		// ošetříme překročení hranic
		if (((Integer) getJSpinnerZoom().getValue()) < 0)
			getJSpinnerZoom().setValue(0);
		if (((Integer) getJSpinnerZoom().getValue()) > 22)
			getJSpinnerZoom().setValue(22);
		
		mapGenerator.setZoom((Integer)getJSpinnerZoom().getValue());
		getJPanelImage().repaint();
	}


	private void jPanelImageMouseMotionMouseDragged(MouseEvent event) {
		actualMouseX=event.getX()-lastMouseX;
		actualMouseY=event.getY()-lastMouseY;
		getJPanelImage().repaint();

	}

	private void jPanelImageMouseMousePressed(MouseEvent event) {
		lastMouseX=event.getX();
		lastMouseY=event.getY();
		

	}

	


	private class JPanelPicture extends JPanel {
		private static final long serialVersionUID = 1L; 

		public void paint(Graphics g){
			Graphics2D g2 = (Graphics2D) g;
			g2.clearRect(0, 0, this.getWidth(), this.getWidth());
			g2.drawImage(mapGenerator.getMap(), null, actualMouseX+1, actualMouseY+1);
		//	g2.draw(new Rectangle(0, 0, 642, 642));
			
			

			
		}
	}
	
	private void jPanelImageMouseMouseReleased(MouseEvent event) {
		mapGenerator.setLatitude(mapGenerator.getLatitude()-mapGenerator.latitudePixelSize()*actualMouseX);
		mapGenerator.setLongitude(mapGenerator.getLongitude()+mapGenerator.longitudePixelSize()*actualMouseY);
		
		getJTextFieldAxisLatitude().setText(String.valueOf(mapGenerator.getLatitude()));
		getJTextFieldAxisLongitude().setText(String.valueOf(mapGenerator.getLongitude()));
		
		actualMouseX=0;
		actualMouseY=0;
		getJPanelImage().repaint();
	}


	private void jComboBox0ItemItemStateChanged(ItemEvent event) {
		switch (getJComboBoxView().getSelectedIndex()){
			case 0: mapGenerator.setMaptype("roadmap");
				break;
			case 1: mapGenerator.setMaptype("satellite");
				break;
			case 2: mapGenerator.setMaptype("terrain");
				break;
			case 3: mapGenerator.setMaptype("hybrid");
				break;
		}
		getJPanelImage().repaint();
	}

	private JMenu getFotoMenu() {
		if(fotoMenu == null) {
			fotoMenu = new JMenu();
			fotoMenu.setText("Fotografie");
			fotoMenu.add(getGenerovatFotoDBMenuItem());
			fotoMenu.add(getSmazatFotoDBMenuItem());
		}
		return fotoMenu;
	}
	
	private JMenu getTrasyMenu() {
		if(trasyMenu == null) {
			trasyMenu = new JMenu();
			trasyMenu.setText("Trasy DB");
			trasyMenu.add(getJMenuItem1());
			trasyMenu.add(getJMenuItem2());
		}
		return trasyMenu;
	}
	
	private JMenu getNapovedaMenu() {
		if(napovedaMenu == null) {
			napovedaMenu = new JMenu();
			napovedaMenu.setText("Nápov\u011bda");
			napovedaMenu.add(getJMenuItem5());
			napovedaMenu.add(getJMenuItem6());
		}
		return napovedaMenu;
	}
	
	private JMenuItem getGenerovatFotoDBMenuItem() {
		if(generovatFotoDBMenuItem == null) {
			generovatFotoDBMenuItem = new JMenuItem();
			generovatFotoDBMenuItem.setText("Scanovat adresá\u0159e");
		}
		return generovatFotoDBMenuItem;
	}
	
	private JMenuItem getSmazatFotoDBMenuItem() {
		if(smazatFotoDBMenuItem == null) {
			smazatFotoDBMenuItem = new JMenuItem();
			smazatFotoDBMenuItem.setText("Smazat foto DB");
		}
		return smazatFotoDBMenuItem;
	}
	
	private JPanel getNastaveniJPanel() {
		if(nastaveniJPanel == null) {
			nastaveniJPanel = new JPanel();
			BoxLayout nastaveniJPanelLayout = new BoxLayout(nastaveniJPanel, javax.swing.BoxLayout.X_AXIS);
			nastaveniJPanel.setPreferredSize(new java.awt.Dimension(938, 73));
			nastaveniJPanel.setLayout(nastaveniJPanelLayout);
			nastaveniJPanel.add(getJPanel1());
			nastaveniJPanel.add(getJPanel3());
			nastaveniJPanel.add(getJPanel2());
			nastaveniJPanel.add(getJPanel4());
		}
		return nastaveniJPanel;
	}
	
	private JPanel getJPanel1() {
		if(jPanel1 == null) {
			jPanel1 = new JPanel();
			
			GroupLayout jPanel1Layout = new GroupLayout((JComponent)jPanel1);
			jPanel1.setLayout(jPanel1Layout);
			jPanel1.setPreferredSize(new java.awt.Dimension(221, 100));
			jPanel1Layout.setHorizontalGroup(jPanel1Layout.createSequentialGroup()
				.addGap(6)
				.addGroup(jPanel1Layout.createParallelGroup()
				    .addGroup(GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup()
				        .addComponent(getJLabelPlace(), GroupLayout.PREFERRED_SIZE, 45, GroupLayout.PREFERRED_SIZE)
				        .addGap(66)
				        .addComponent(getJButton0(), GroupLayout.PREFERRED_SIZE, 89, GroupLayout.PREFERRED_SIZE))
				    .addGroup(jPanel1Layout.createSequentialGroup()
				        .addComponent(getJTextFieldPlace(), GroupLayout.PREFERRED_SIZE, 203, GroupLayout.PREFERRED_SIZE)))
				.addContainerGap(12, Short.MAX_VALUE));
			jPanel1Layout.setVerticalGroup(jPanel1Layout.createSequentialGroup()
				.addGap(8)
				.addGroup(jPanel1Layout.createParallelGroup(GroupLayout.Alignment.BASELINE)
				    .addComponent(getJButton0(), GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, 19, GroupLayout.PREFERRED_SIZE)
				    .addComponent(getJLabelPlace(), GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE))
				.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
				.addComponent(getJTextFieldPlace(), GroupLayout.PREFERRED_SIZE, 24, GroupLayout.PREFERRED_SIZE)
				.addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE));
		}
		return jPanel1;
	}
	
	private JPanel getJPanel2() {
		if(jPanel2 == null) {
			jPanel2 = new JPanel();
			GroupLayout jPanel2Layout = new GroupLayout((JComponent)jPanel2);
			jPanel2.setLayout(jPanel2Layout);
			jPanel2.setPreferredSize(new java.awt.Dimension(111, 100));
			jPanel2Layout.setHorizontalGroup(jPanel2Layout.createSequentialGroup()
				.addContainerGap()
				.addGroup(jPanel2Layout.createParallelGroup()
				    .addGroup(GroupLayout.Alignment.LEADING, jPanel2Layout.createSequentialGroup()
				        .addComponent(getJComboBoxView(), GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
				        .addGap(0, 20, Short.MAX_VALUE))
				    .addGroup(jPanel2Layout.createSequentialGroup()
				        .addComponent(getJLabelView(), GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
				        .addGap(0, 0, Short.MAX_VALUE)))
				.addContainerGap());
			jPanel2Layout.setVerticalGroup(jPanel2Layout.createSequentialGroup()
				.addContainerGap()
				.addComponent(getJLabelView(), GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
				.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
				.addComponent(getJComboBoxView(), GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
				.addContainerGap(45, Short.MAX_VALUE));
		}
		return jPanel2;
	}
	
	private JPanel getJPanel3() {
		if(jPanel3 == null) {
			jPanel3 = new JPanel();
			GroupLayout jPanel3Layout = new GroupLayout((JComponent)jPanel3);
			jPanel3.setLayout(jPanel3Layout);
			jPanel3.setPreferredSize(new java.awt.Dimension(60, 100));
			jPanel3Layout.setHorizontalGroup(jPanel3Layout.createSequentialGroup()
				.addGroup(jPanel3Layout.createParallelGroup()
				    .addGroup(GroupLayout.Alignment.LEADING, jPanel3Layout.createSequentialGroup()
				        .addComponent(getJLabelZoom(), GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
				        .addGap(0, 8, Short.MAX_VALUE))
				    .addGroup(jPanel3Layout.createSequentialGroup()
				        .addComponent(getJSpinnerZoom(), GroupLayout.PREFERRED_SIZE, 48, GroupLayout.PREFERRED_SIZE)
				        .addGap(0, 0, Short.MAX_VALUE)))
				.addContainerGap());
			jPanel3Layout.setVerticalGroup(jPanel3Layout.createSequentialGroup()
				.addContainerGap()
				.addComponent(getJLabelZoom(), GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
				.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
				.addComponent(getJSpinnerZoom(), GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
				.addContainerGap(45, Short.MAX_VALUE));
		}
		return jPanel3;
	}
	
	private JPanel getJPanel4() {
		if(jPanel4 == null) {
			jPanel4 = new JPanel();
			GroupLayout jPanel4Layout = new GroupLayout((JComponent)jPanel4);
			jPanel4.setLayout(jPanel4Layout);
			jPanel4.setPreferredSize(new java.awt.Dimension(462, 100));
			jPanel4Layout.setHorizontalGroup(jPanel4Layout.createSequentialGroup()
				.addContainerGap()
				.addComponent(getJLabelAxis(), GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
				.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
				.addGroup(jPanel4Layout.createParallelGroup()
				    .addComponent(getJTextFieldAxisLatitude(), GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 185, GroupLayout.PREFERRED_SIZE)
				    .addComponent(getJTextFieldAxisLongitude(), GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 185, GroupLayout.PREFERRED_SIZE))
				.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
				.addComponent(getJButtonAxis(), GroupLayout.PREFERRED_SIZE, 97, GroupLayout.PREFERRED_SIZE)
				.addContainerGap(101, Short.MAX_VALUE));
			jPanel4Layout.setVerticalGroup(jPanel4Layout.createSequentialGroup()
				.addContainerGap()
				.addGroup(jPanel4Layout.createParallelGroup()
				    .addGroup(GroupLayout.Alignment.LEADING, jPanel4Layout.createSequentialGroup()
				        .addGroup(jPanel4Layout.createParallelGroup(GroupLayout.Alignment.BASELINE)
				            .addComponent(getJTextFieldAxisLatitude(), GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
				            .addComponent(getJLabelAxis(), GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE))
				        .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
				        .addComponent(getJTextFieldAxisLongitude(), GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE))
				    .addGroup(jPanel4Layout.createSequentialGroup()
				        .addComponent(getJButtonAxis(), GroupLayout.PREFERRED_SIZE, 50, GroupLayout.PREFERRED_SIZE)))
				.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, 0, Short.MAX_VALUE));
		}
		return jPanel4;
	}
	
	private JPanel getMapaJPanel() {
		if(mapaJPanel == null) {
			mapaJPanel = new JPanel();
			BorderLayout mapaJPanelLayout = new BorderLayout();
			mapaJPanel.setLayout(mapaJPanelLayout);
			mapaJPanel.setPreferredSize(new java.awt.Dimension(942, 633));
		}
		return mapaJPanel;
	}
	
	private JMenuItem getJMenuItem1() {
		if(jMenuItem1 == null) {
			jMenuItem1 = new JMenuItem();
			jMenuItem1.setText("Na\u010díst trasu ze souboru");
		}
		return jMenuItem1;
	}
	
	private JMenuItem getJMenuItem2() {
		if(jMenuItem2 == null) {
			jMenuItem2 = new JMenuItem();
			jMenuItem2.setText("Smazat v\u0161echny trasy v DB");
		}
		return jMenuItem2;
	}
	
	private JMenuItem getJMenuItem3() {
		if(jMenuItem3 == null) {
			jMenuItem3 = new JMenuItem();
			jMenuItem3.setText("Vybrat existující databázi");
			jMenuItem3.addActionListener(new ActionListener() {
				public void actionPerformed(ActionEvent evt) {
					jMenuItem3ActionPerformed(evt);
				}
			});
		}
		return jMenuItem3;
	}
	
	private JMenuItem getJMenuItem4() {
		if(jMenuItem4 == null) {
			jMenuItem4 = new JMenuItem();
			jMenuItem4.setText("Vytvo\u0159it novou databázi");
		}
		return jMenuItem4;
	}
	
	private JMenuItem getJMenuItem5() {
		if(jMenuItem5 == null) {
			jMenuItem5 = new JMenuItem();
			jMenuItem5.setText("Nápov\u011bda");
		}
		return jMenuItem5;
	}
	
	private JMenuItem getJMenuItem6() {
		if(jMenuItem6 == null) {
			jMenuItem6 = new JMenuItem();
			jMenuItem6.setText("O programu");
		}
		return jMenuItem6;
	}
	
	private JPanel getStatusJPanel() {
		if(statusJPanel == null) {
			statusJPanel = new JPanel();
			statusJPanel.setPreferredSize(new java.awt.Dimension(938, 20));
			statusJPanel.setBorder(BorderFactory.createCompoundBorder(
					null, 
					null));
			statusJPanel.add(getStatusJLabel());
		}
		return statusJPanel;
	}
	
	private JLabel getStatusJLabel() {
		if(statusJLabel == null) {
			statusJLabel = new JLabel();
			statusJLabel.setText("Yeh ja jsem status bar.. ");
		}
		return statusJLabel;
	}
	
	private void jMenuItem3ActionPerformed(ActionEvent evt) {
		final JFileChooser fc = new JFileChooser();
		int returnVal = fc.showOpenDialog(this);


	}

}
